<!doctype html>
<html >
<head>
	<meta charset="UTF-8">
	<title>运行记录-RPA机器人工作台</title>
	<meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
	<link rel="stylesheet" href="/rpa_work/static/css/xadmin.css?v=1.01">
    <script type="text/javascript" src="/rpa_work/static/js/jquery.min.js"></script>
    <script type="text/javascript" src="/rpa_work/static/js/jquery.cookie.js"></script>
    <script src="/rpa_work/static/layui/layui.js" charset="utf-8"></script>
    <script>var page="tasklog";</script>
	<script type="text/javascript" src="/rpa_work/static/js/xadmin.js?v=1.0"></script>
	<script type="text/javascript" charset="utf-8" src="/rpa_work/static/js/xm-select.js"></script>
    <script type="text/javascript" src="/rpa_work/static/js/target_window.js"></script>
</head>
    <body>

        <div class="x-body">
        
		<div class="layui-card">
		  <div class="layui-card-body">
		    	<div class="layui-row">
					<form class="layui-form layui-col-md12 x-so layui-form-pane" method="get" id="myform" lay-filter="searchform">
                      <div class="form-item layui-inline" id="searchtask">
                        <label class="layui-form-label">任务名称</label>
                        <div class="layui-input-block">
							<input type="text" name="flow_name" placeholder="请输入任务名称" autocomplete="off" class="layui-input">
                        </div>
                      </div>
                      <div class="form-item layui-inline">
                        <label class="layui-form-label">任务状态</label>
                        <div class="layui-input-block">
                          <select name="status">
                            <option value=""></option>
                            <option value="成功">成功</option>
                            <option value="失败">失败</option>
                          </select>
                        </div>
                      </div>
                      <div class="form-item layui-inline">
                        <label class="layui-form-label">执行日期</label>
                        <div class="layui-input-block">
                          <input type="text" name="progress" placeholder="" autocomplete="off" class="layui-input" id="starttime">
                        </div>
                      </div>
					  <div class="layui-inline">
                          <div class="layui-input-inline">
                          <a class="layui-btn"  lay-submit="" lay-filter="search" id="searchbtn">查询</a>
                          </div>
                      </div>

					</form>
				</div>
		
			<table class="layui-hide" lay-data="{id: 'list_table'}" id="list_table" lay-filter="list_table"></table>
		  </div>
		</div>
      </div>
		
	 	
		<script>
	 var taskid=getqueryparam('taskid');
	 var postdata={'sid': sid,'progress':getTodayDate()};
	 if(taskid !=null){
	    postdata.flow_id=taskid;
	    $('#searchtask').hide();
	 }
	 //console.log(postdata);

	    layui.use(['laydate','form','laypage','layer','table'], function(){
                $ = layui.jquery;
              var laydate = layui.laydate;
              var layer = layui.layer;
			  var form = layui.form;
			  var table = layui.table;


			  laydate.render({
				elem: '#starttime'
				,value:new Date()
			  });

			  table.render({
				elem: '#list_table'
				,height: 600
				,cellMinWidth: 60
				,url: apiurl+'Execution_history'
				,method:'post'
				,contentType: 'application/json'
				,where: postdata
				,response: {
				  statusName: 'status'
				} 
				,page: true
				//,size:'lg'
				,page: { 
				  layout: ['count', 'prev', 'page', 'next', 'refresh']
				  ,groups: 5 
				  ,first: true
				  ,last: true
				  ,limit:100
				  ,first: '首页'
				  ,last: '尾页'
				}
				,initSort:{field:'start_time', type:'desc'}
				,cols: [[
				  {field: 'flow_name', title: '任务名称',align:'center',minWidth:150},
				  {field: 'robot_name', title: '机器人',align:'center',minWidth:150},
				  {field: 'status', title: '执行结果',align:'center',minWidth:80},
				  {field: 'start_time', title: '开始时间',align:'center',minWidth:180},
				  {field: 'stop_time', title: '结束时间',align:'center',minWidth:180}
				]]
				,done: function(res, curr, count){
				  	checklogin(res);

				}
			  });

				form.on('submit(search)', function(data){
					postdata=Object.assign(postdata,data.field);
					//console.log(postdata);
					table.reload('list_table', {
					  url: apiurl+'Execution_history'
					  ,contentType: 'application/json'
					  ,where: postdata
					  ,page: {
						layout: ['count', 'prev', 'page', 'next', 'refresh']
				        ,curr: 1
					  }
					});
				   
					return false;
				  });
              
            });

		
       </script>
    </body>
</html>